﻿
@{
    ViewBag.Title = "BindList";
}
<!DOCTYPE html>
 
<head>
    
   
    <link type="text/css" href="../Layui/css/layui.css" rel="stylesheet" media="all">
    <script type="text/javascript" src="../Htc/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="../Layui/layui.js"></script>
   
</head>
<form class="layui-form" action="" lay-filter="component-form-group">
    <div class="layui-card-body">
        <table class="layui-table" lay-skin="line" lay-filter="Rytable" id="Rytable"></table>
    </div>
 </form>
<script>
    layui.config({
        base: '../Layui/'
    }).extend({
        index: 'lib/index'
        }).use('index');
    layui.use('table', function () {
        var table = layui.table;
        var djUrl = "../Account/BindList/Data";

        var column = [[{ field: 'id', title: 'ID' }, { field: 'CustName', title: '宝宝姓名' }, { field: 'CustTel', title: '联系电话' }, { field: 'LinkName', title: '联系人' }, { field: 'Sex', title: '性别' }, { field: 'MakeDate', title: '预约日期' }, { field: 'ClassroomName', title: '教室' }, { field: 'CourseName', title: '课程' }, { field: 'ClassName', title: '系列名称' }, { field: 'TeacherName', title: '教师' }, { field: 'sshowName', title: '顾问' }]];
        if ("@ViewBag.ClassName" == "02")
            column = [[{ field: 'id', title: 'ID' }, { field: 'CustName', title: '宝宝姓名' }, { field: 'CustTel', title: '联系电话' }, { field: 'LinkName', title: '联系人' }, { field: 'Sex', title: '性别' }, { field: 'contractNumber', title: '合同编号' }, { field: 'SetmealName', title: '合同套餐' }, { field: 'ContractPrice', title: '合同金额' }, { field: 'DisPrice', title: '合同实收' }, { field: 'ContractJe', title: '合同已收' }, { field: 'ce', title: '差额' }, { field: 'sshowName', title: '顾问' }]];
        if("@ViewBag.ClassName" == "03")
        column = [[{ field: 'id', title: 'ID' }, { field: 'Name', title: '宝宝姓名' }, { field: 'Tel', title: '联系电话' }, { field: 'LinkName', title: '联系人' }, { field: 'subscribeDate', title: '报名日期' }, { field: 'ActivityName', title: '活动名称' }, { field: '会员价格', title: 'MPrice' }, { field: 'Classhour', title: '抵课时' }, { field: 'ActDate', title: '活动日期' }, { field: 'Ylfw', title: '年龄范围' }, { field: 'EndSign', title: '截止日期' }, { field: 'ChargeName', title: '活动负责人' }]];
       
        table.render({
            elem: '#Rytable'
            , url: djUrl //数据接口
            , where: { keyCode: "@ViewBag.keyCode",  id: "@ViewBag.Cid",ClassName: "@ViewBag.ClassName", t: new Date().getTime() }
           
            , limit: 10
            , page: true //是否显示分页
            , cellMinWidth: 120 
            , cols: column

            , skin: 'line' //表格风格
            , even: true

        });
        table.on('row(Rytable)', function (obj) {

            var data = obj.data;
            
                     $.ajax({
                type: 'POST',
                         url: "../Account/BindList/UpdateState",
                         data: {
                             id: data.id,
                       KeyCode:'@ViewBag.KeyCode',
                             AccountId: '@ViewBag.Id',
                             ClassName: '@ViewBag.ClassName',
                    t: new Date().getTime()
                },
                dataType: "json",
                success: function (data) {
                    if (data.code == "0000") {
                        layui.layer.msg("绑定成功", {
                        }, function () {
                            parent.location.reload();
                            });
                    } else
                        layui.layer.msg(data.message);
                }
            });
          
           
           
        });
    });
</script>